<?php
/**
 * Created by PhpStorm.
 * User: jacob
 * Date: 18-10-18
 * Time: 下午12:00
 */
namespace DB;

use Common\Logger;

class RedisDefault{
  private static $_instance;

  public static function getInstance(){
    if (self::$_instance == null){
      $redis = new \Redis();
      $res = $redis->connect(\RedisConfig::Host,
        \RedisConfig::port,\RedisConfig::TimeOut);
      if (!$res){
        Logger::getInstance()->info("redis connect is failed");
      }
      Logger::getInstance()->info("redis connect is success");
      $redis->select(0);
      self::$_instance = $redis;
    }
    return self::$_instance;
  }

}